UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't5agL6k5w0iWw/IytiTN9CJr2BXeeLBqQXPT1nIjccI=' 
WHERE 
  key_id = 'a819234496f7bb4ff14c40f835d0ae1ac875be1a52dc75ee282f198336375606' 
  AND (
    token = 't5agL6k5w0iWw/IytiTN9CJr2BXeeLBqQXPT1nIjccI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032