UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GSCogEQw/br7dZ29Hz4Y/DRCm+2/x4DE34JteQBTeE0=' 
WHERE 
  key_id = '8681a335c850ae37b427cc62e367f6143b0581f1ef40f5144b2062067670d169' 
  AND (
    token = 'GSCogEQw/br7dZ29Hz4Y/DRCm+2/x4DE34JteQBTeE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033