UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nmJR0a/87f+YU4hB1FbifCnYn/eQtW7DwRBJmyHDIRE=' 
WHERE 
  key_id = 'a950a585583fb60b0afe859b5769f8d863389846e8c89230d5506e67d8b30132' 
  AND (
    token = 'nmJR0a/87f+YU4hB1FbifCnYn/eQtW7DwRBJmyHDIRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040