UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gyX5LmtoBRDmiGsL2T5h2hYyFct5wPEleZPSzs3TT68='
WHERE
key_id = '560ad06ed43d51807e71da2ace8922a9a0eca44dc6377d68bb7b1cd4ddbabb4b'
AND (
token = 'gyX5LmtoBRDmiGsL2T5h2hYyFct5wPEleZPSzs3TT68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)