UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cDhyKl4Fb6Ez8TwdliqRW1unOVzH9CaPUdjgpSNW404=' 
WHERE 
  key_id = '27b7885b2277742230c247c9a10cb08594f765fca6778bbc5ff961c3042ab957' 
  AND (
    token = 'cDhyKl4Fb6Ez8TwdliqRW1unOVzH9CaPUdjgpSNW404=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038