UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRkisSGj1+Nr81Y5n0JYbuXf7x/qzFRDamL+lZLO0ps='
WHERE
key_id = 'baeeed1e586138d1eebeadbbeaaa313f0b903f5b27c6457eaab5d6004afeab32'
AND (
token = 'QRkisSGj1+Nr81Y5n0JYbuXf7x/qzFRDamL+lZLO0ps='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)