UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JG4ugHmSO8WymV5BDT8hMmWiDK0qgD2VKkkjSP40WDI=' 
WHERE 
  key_id = '22ae314d381d14b1aabaef6cf29977cd49b325c28e543da941ebf23b401d18b9' 
  AND (
    token = 'JG4ugHmSO8WymV5BDT8hMmWiDK0qgD2VKkkjSP40WDI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049