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