UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ol8UxShtaBpuT9cDlJL4usZv95Ooak0kPs8Wn5Scmgw='
WHERE
key_id = 'fe1ec267ce90c00de7e8a5f935a8f150d57c9e7913b6a73f8599e21ca9d7a740'
AND (
token = 'ol8UxShtaBpuT9cDlJL4usZv95Ooak0kPs8Wn5Scmgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)