UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FNfAFWQXEm/Uz/f3dDFLwtTZTp8JSRg3YtNXqOmJjzY=' 
WHERE 
  key_id = '51d04adc6adc93225de2272f601cb9fc2a288b3555e8b5864a105646fa417211' 
  AND (
    token = 'FNfAFWQXEm/Uz/f3dDFLwtTZTp8JSRg3YtNXqOmJjzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026