UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4B7YSGiTxgQIKjqGsfRbPFeXOK8FEMImlVZ46glzpOM='
WHERE
key_id = '1db1681412fd63f629610a01169cc070586dc1554b20de09ede238c790ed8f8c'
AND (
token = '4B7YSGiTxgQIKjqGsfRbPFeXOK8FEMImlVZ46glzpOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)