UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N9/t4ReDK+09KJKLup3xFE6WDaIl1PV/REbYn/rYqd4=' 
WHERE 
  key_id = 'b1fbc8e7260e5e0b92db0b62c429b35ab637d3cd368c25f5e2ab0af881ec2746' 
  AND (
    token = 'N9/t4ReDK+09KJKLup3xFE6WDaIl1PV/REbYn/rYqd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035