UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'esdzvyYLQLPVk2cub0aJ1GoB9rSNVEQzA3tLrkwUb0k=' 
WHERE 
  key_id = '4fda005d53b2c4768a2f370b86aa86fd74d0bd6c8913c839ac45c73d17ece981' 
  AND (
    token = 'esdzvyYLQLPVk2cub0aJ1GoB9rSNVEQzA3tLrkwUb0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034