UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WJi7lt2nfCVb6RREDXQ8MM8mobTj6dAGsjmCPppktcM=' 
WHERE 
  key_id = 'b15f53ac8f8acd84a9cb27a2be198888232d7101fc887fa750b929739176f943' 
  AND (
    token = 'WJi7lt2nfCVb6RREDXQ8MM8mobTj6dAGsjmCPppktcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030