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