UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZeBVubLTemmCJmMR4cccX0+jzUa3aMRuWEJ0GKOTBvo=' 
WHERE 
  key_id = '3bcff437065a118a6fa829e14d1c4631766303a531fd0fb8c57c0a282118efab' 
  AND (
    token = 'ZeBVubLTemmCJmMR4cccX0+jzUa3aMRuWEJ0GKOTBvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031