UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o/VfFicag54VSgEO10jd3sCGvJ4Af3A0z5+YbPRQ3s0='
WHERE
key_id = 'b4c02a6d1d764e527d15144d2fc2c48645c1bd5175e789946a95bb94af566b15'
AND (
token = 'o/VfFicag54VSgEO10jd3sCGvJ4Af3A0z5+YbPRQ3s0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)