UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8rXCXYzgJc3KCNZxhxn1A9lLjd8Fh5WScpPlkYr7dFM=' 
WHERE 
  key_id = 'a5c10104b19ef8ae38f8e5c0d114321d92b69e27d5b702f751cf6482d801251d' 
  AND (
    token = '8rXCXYzgJc3KCNZxhxn1A9lLjd8Fh5WScpPlkYr7dFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032