UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kw+RGrwdeBYBEI/nMGiv0enAVQiIRlq28o8LcftWofA=' 
WHERE 
  key_id = '859a212f232a573b0b3312bf5cbefe0bf7513b8f1886eeddb60c84b79e74aa3b' 
  AND (
    token = 'Kw+RGrwdeBYBEI/nMGiv0enAVQiIRlq28o8LcftWofA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032