UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xBq1WPsj32wUh8NLww5meZfl9M3hduU+nKdiGsNHZTg='
WHERE
key_id = 'ff680e39a2695002633702da645844f60c67fef063f5898255b40b49bb858c61'
AND (
token = 'xBq1WPsj32wUh8NLww5meZfl9M3hduU+nKdiGsNHZTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)