UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N8UmiPsGRn7VitsBwnz5WO9P6n9IdKgz51E9qFWWRM0=' 
WHERE 
  key_id = '68367dcd47b1e302608014b2248584fc186a34e49720012828726ba632c71f5c' 
  AND (
    token = 'N8UmiPsGRn7VitsBwnz5WO9P6n9IdKgz51E9qFWWRM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028