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