UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qLvqTInsG/mkC4P4iGp5GzqfYmW5w+zOCXWKuo6yMvs='
WHERE
key_id = '22e4184db55df7401cab7d181bba9f2f4a75cc62259658f860aaf934ea1e9822'
AND (
token = 'qLvqTInsG/mkC4P4iGp5GzqfYmW5w+zOCXWKuo6yMvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)