UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9KIbsNgc79CmzaTySuzbzJaHa8qiSSLIFj+mpHGIk0=' 
WHERE 
  key_id = 'd175516f3149c76189c95db9d815ce8678cfe56ff85752194191defb91bf185f' 
  AND (
    token = 'd9KIbsNgc79CmzaTySuzbzJaHa8qiSSLIFj+mpHGIk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033