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