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