UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zPQ3R0ikqzOmqJ9B7tknpwPHviX41AJopJ/1JMmSSEw='
WHERE
key_id = 'bde6f4671c85324f4855345b1b080b8b0408fef383d1e52a2375daca89dbdb2a'
AND (
token = 'zPQ3R0ikqzOmqJ9B7tknpwPHviX41AJopJ/1JMmSSEw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)