UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQj6Q/NlQ70YN2ieH4dNFU7Bw8qIHHY8AB4IOXH8r8Q='
WHERE
key_id = '9922b8a70971a5407e703467c4a6d91a9913c16938ee7562386371f0f3e3df03'
AND (
token = 'tQj6Q/NlQ70YN2ieH4dNFU7Bw8qIHHY8AB4IOXH8r8Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)