UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xGpwpcApCoKAx0yJBP5p8pw9NUEHq5y8PtETyUypfpA='
WHERE
key_id = '686a213fea008d299639c61910436242c54683a060ce7da0074a7641b9b6467b'
AND (
token = 'xGpwpcApCoKAx0yJBP5p8pw9NUEHq5y8PtETyUypfpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)