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