UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LfwcFtrHJtF5UFcsWvFwHYTZQQCwcf0+aXATqnJ2dZc=' 
WHERE 
  key_id = '004eaf5464ca2d17d6f5f7e24e91da43de57b6677b5729555cad2f2a38887ac8' 
  AND (
    token = 'LfwcFtrHJtF5UFcsWvFwHYTZQQCwcf0+aXATqnJ2dZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039