UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nYr9sJ8hs8TV2wpGxRRcSd4tS68w9OmBw0QPanbh+RQ='
WHERE
key_id = '8606a388ee0508416089e76fee81633a904d8b172a1ef69812c72e016af2c607'
AND (
token = 'nYr9sJ8hs8TV2wpGxRRcSd4tS68w9OmBw0QPanbh+RQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)