UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+hh3svBPSCHfHbeWuCZTNuTttqj5HxB0ziAzEu734U=' 
WHERE 
  key_id = '815299625389f4012728dc9c69fd7b16cb92742016c9a78bc4e2668f102e6bf8' 
  AND (
    token = 'N+hh3svBPSCHfHbeWuCZTNuTttqj5HxB0ziAzEu734U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00108