UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YBMmSA/G97K8F2iwlbNg7LDjyFAEkUapu3AA4v7wQ8s='
WHERE
key_id = '604ab50407cf2d6a0bdd1cd1432a51d3959cb9139375e91362dc723f115c29d6'
AND (
token = 'YBMmSA/G97K8F2iwlbNg7LDjyFAEkUapu3AA4v7wQ8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)