UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h7LYPiRsbBxQ31OGgCZzXW4n/J7gAdzZQQ5/ha7RFn8='
WHERE
key_id = 'add2616925970bf22a5b886c430344f1ba612489a1069d3504ea1b6f23ca3c34'
AND (
token = 'h7LYPiRsbBxQ31OGgCZzXW4n/J7gAdzZQQ5/ha7RFn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)