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