UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COLkgUX3Ud4ObE9c08CKroPYF6Q6otLV20om1vdYvB8='
WHERE
key_id = '0d7387bcba4bcd6349c5e24ec3c8916127f42bfaa3f8bdf86371190273bdd25e'
AND (
token = 'COLkgUX3Ud4ObE9c08CKroPYF6Q6otLV20om1vdYvB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)