UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jWDc+w+bkwUTKNnSFibfMo3foYnMG1s9K0DmFZhkOK8=' 
WHERE 
  key_id = 'a851a2ab345962d6a46c5ed974d26274191f569a7ad34d2e1aaf981e6f386e3a' 
  AND (
    token = 'jWDc+w+bkwUTKNnSFibfMo3foYnMG1s9K0DmFZhkOK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033