UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IQ2O/nsh6qOxtgra2JrF61w95h7hYMyqXk/QptM+MbQ=' 
WHERE 
  key_id = 'eb8cbaecd1420f53536ab8ba7e163fa4e717220317d1aeaa8d71269b0cea00a6' 
  AND (
    token = 'IQ2O/nsh6qOxtgra2JrF61w95h7hYMyqXk/QptM+MbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038