UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EmEPyjIBcONEuTmUwPpYGHarUjEZv+6KnwccoF7wcTg='
WHERE
key_id = '15313cf3e442c915f487646d2994ea7d4517085d510115233772d7b859c5f5a0'
AND (
token = 'EmEPyjIBcONEuTmUwPpYGHarUjEZv+6KnwccoF7wcTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)