UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7aRXVdw7OVBHeI2Jhx0t28TtOY2iIloO8o2AuXevc3o=' 
WHERE 
  key_id = '5a1d38763934cdb2e69de44d2c3cafdccc4c6178f84e679869b44c463c7bf716' 
  AND (
    token = '7aRXVdw7OVBHeI2Jhx0t28TtOY2iIloO8o2AuXevc3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079