UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A5LNXvoP9AiHjhO9cSWQthUKnREQ5RtRPQC85A/HYg0='
WHERE
key_id = 'fcb10f4898d9c0a8f2aecc123af83bdb36f40c9780df9c3ef3b73c385db408eb'
AND (
token = 'A5LNXvoP9AiHjhO9cSWQthUKnREQ5RtRPQC85A/HYg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)