UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0AnvgQlZ9DvPh5KzcYI7faedV5+asxczbLC4Vs2iWO4='
WHERE
key_id = 'd0132c4fcd72cd7c09340c89fbe23817950e6c522ca561b85500bf281185ef25'
AND (
token = '0AnvgQlZ9DvPh5KzcYI7faedV5+asxczbLC4Vs2iWO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)