UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vbdm8+wbNPfgLD5eATwWWIjZO7k3B2EpDh1/xVj+4ck=' 
WHERE 
  key_id = 'fe8182caa3568f3fa1dd7f07280257e472d681fb7edbd46790d80329a8474c80' 
  AND (
    token = 'Vbdm8+wbNPfgLD5eATwWWIjZO7k3B2EpDh1/xVj+4ck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041